AWSS3GetBucket
Type
command
Summary
Get a bucket description.
Syntax
AWSS3GetBucket <pBucket>,<pParameters>,<pCallback>
Description
The caller of this command will be sent the callback message on completion with two parameters:
- the request ID
- the response from the server parsed into an array.
- an error message if one occurred
The array contains details about the bucket including objects it contains.
note
The message is sent before the tsNet connection is closed so it is possible to access the recieved headers using the tsNetRetrHeaders function
For futher details about this API see the AWS S3 REST API Documentation
Parameters
Name | Type | Description |
---|---|---|
pBucket | The name of a bucket | |
pParameters | An array containing parameters to include in the request:
| |
pCallback | A command name to be sent on completion with the server reponse. |
Examples
local tParameters
put "/" into tParameters["delimiter"]
put "images/" into tParameters["prefix"]
AWSS3GetBucket "mybucket", tParameters, "getImagesFromBucketCallback"
put it into tRequestID
on getImagesFromBucketCallback pRequestID, pResult, pError
if pError is empty then
local tObjectKeys
if isSeq(pResult["Contents"]) then
repeat with tIndex = 1 to the number of elements of pResult["Contents"]
put pResult["Contents"][tIndex]["Key"] & return after tObjectKeys
end repeat
else
-- only one result
put pResult["Contents"]["Key"] & return after tObjectKeys
end if
end if
end getImagesFromBucketCallback
function isSeq pSeq
return item 2 of extents(pSeq) is the number of elements in pSeq
end isSeq
Related
function: tsNetGetStatus, tsNetRetrHeaders
library: tsNet